import dynamic from 'umi/dynamic';

// 按需加载组件
const delay = (timeout) => new Promise(resolve => setTimeout(resolve, timeout));
const App = dynamic({
  loader: async function() {
    await delay(/* 1s */1000);
    return () => <div>I will render after 1s</div>;
  },
});

// 按需加载模块
import('g2').then(() => {
  // do something with g2
});